package cn.com.aiton.common.utils;

/**
 * 信号机进行手动控制时
 * 将信号机的相位进行自定义控制
 * 将81 E9 00 02 01 00 40 00 00 数据进行位操作
 */
public class CustomeControlUtils {
    /**
     * 北左放行
     * @param by
     * @return
     */
    public static byte[] northLeft(byte[] by){
        byte ns = (byte)(by[5]|0x01);
        by[5] = ns;
        return by;
    }
    /**
     * 北直放行
     * @param by
     * @return
     */
    public static byte[] northStraight(byte[] by){
        byte ns = (byte)(by[5]|0x02);
        by[5] = ns;
        return by;
    }
    /**
     * 北直放行
     * @param by
     * @return
     */
    public static byte[] northRight(byte[] by){
        byte ns = (byte)(by[5]|0x04);
        by[5] = ns;
        return by;
    }
    /**
     * 北直放行
     * @param by
     * @return
     */
    public static byte[] northPedestrain(byte[] by){
        byte ns = (byte)(by[5]|0x08);
        by[5] = ns;
        return by;
    }
    /**
     * 北直放行
     * @param by
     * @return
     */
    public static byte[] northPedestrain2(byte[] by){
        byte ns = (byte)(by[5]|0x10);
        by[5] = ns;
        return by;
    }
    /**
     * 北左放行
     * @param by
     * @return
     */
    public static byte[] eastLeft(byte[] by){
        byte ns = (byte)(by[6]|0x01);
        by[6] = ns;
        return by;
    }
    /**
     * 北直放行
     * @param by
     * @return
     */
    public static byte[] eastStraight(byte[] by){
        byte ns = (byte)(by[6]|0x02);
        by[6] = ns;
        return by;
    }
    /**
     * 北直放行
     * @param by
     * @return
     */
    public static byte[] eastRight(byte[] by){
        byte ns = (byte)(by[6]|0x04);
        by[6] = ns;
        return by;
    }
    /**
     * 北直放行
     * @param by
     * @return
     */
    public static byte[] eastPedestrain(byte[] by){
        byte ns = (byte)(by[6]|0x08);
        by[6] = ns;
        return by;
    }
    /**
     * 北直放行
     * @param by
     * @return
     */
    public static byte[] eastPedestrain2(byte[] by){
        byte ns = (byte)(by[6]|0x10);
        by[6] = ns;
        return by;
    }
    /**
     * 北左放行
     * @param by
     * @return
     */
    public static byte[] southLeft(byte[] by){
        byte ns = (byte)(by[7]|0x01);
        by[7] = ns;
        return by;
    }
    /**
     * 北直放行
     * @param by
     * @return
     */
    public static byte[] southStraight(byte[] by){
        byte ns = (byte)(by[7]|0x02);
        by[7] = ns;
        return by;
    }
    /**
     * 北直放行
     * @param by
     * @return
     */
    public static byte[] southRight(byte[] by){
        byte ns = (byte)(by[7]|0x04);
        by[7] = ns;
        return by;
    }
    /**
     * 北直放行
     * @param by
     * @return
     */
    public static byte[] southPedestrain(byte[] by){
        byte ns = (byte)(by[7]|0x08);
        by[7] = ns;
        return by;
    }
    /**
     * 北直放行
     * @param by
     * @return
     */
    public static byte[] southPedestrain2(byte[] by){
        byte ns = (byte)(by[7]|0x10);
        by[7] = ns;
        return by;
    }
    /**
     * 北左放行
     * @param by
     * @return
     */
    public static byte[] westLeft(byte[] by){
        byte ns = (byte)(by[8]|0x01);
        by[8] = ns;
        return by;
    }
    /**
     * 北直放行
     * @param by
     * @return
     */
    public static byte[] westStraight(byte[] by){
        byte ns = (byte)(by[8]|0x02);
        by[8] = ns;
        return by;
    }
    /**
     * 北直放行
     * @param by
     * @return
     */
    public static byte[] westRight(byte[] by){
        byte ns = (byte)(by[8]|0x04);
        by[8] = ns;
        return by;
    }
    /**
     * 北直放行
     * @param by
     * @return
     */
    public static byte[] westPedestrain(byte[] by){
        byte ns = (byte)(by[8]|0x08);
        by[8] = ns;
        return by;
    }
    /**
     * 北直放行
     * @param by
     * @return
     */
    public static byte[] westPedestrain2(byte[] by){
        byte ns = (byte)(by[8]|0x10);
        by[8] = ns;
        return by;
    }
}
